package com.bolun998300.personal_blog_springboot.pojo;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.data.elasticsearch.annotations.Document;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@Table(name="blog")
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
@Document(indexName = "personal_blog_springboot",type = "blog")
public class Blog {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)//主键生成策略，主键自增长
    @Column(name = "id")
    private int id;
    //标题
    @Column(name="title")
    private String title;
    //概要
    @Column(name="summary")
    private String summary;
    //发布日期
    @Column(name="release_date")
    private Date releaseDate;
    //点击数
    @Column(name="click_hit")
    private int clickHit;
    //回复数
    @Column(name="reply_hit")
    private int replyHit;
    //内容
    @Column(name="content")
    private String content;
    //内容无标签
    @Column(name="contentNoTag")
    private String contentNoTag;
    //类型id
    @Column(name="type_id")
    private int typeId;
    //关键字
    @Column(name="key_word")
    private String keyWord;
    //创建时间
    @Column(name="create_time")
    private Date createTime;
    //更新时间
    @Column(name="update_time")
    private Date updateTime;
    //是否删除
    @Column(name="is_delete")
    private boolean isDelete;

    //文章状态 0-已存草稿 1-已发布 2-定时发布 3-已删除
    @Column(name="newsStatus")
    private int newsStatus;
    //1—'开放浏览'，0-'私密浏览'
    @Column(name="newsLook")
    private boolean newsLook;
    //是否置顶 1-置顶 0-不置顶
    @Column(name="newsTop")
    private boolean newsTop;
    //文章作者
    @Column(name="newsAuthor")
    private String newsAuthor;
    //封面图片
    @Column(name="newsFaceImg")
    private String newsFaceImg;
    
    
    public String getNewsFaceImg() {
		return newsFaceImg;
	}

	public void setNewsFaceImg(String newsFaceImg) {
		this.newsFaceImg = newsFaceImg;
	}

	/*---非数据库字段---*/
	@Transient
    private String typeName;
	
	@Transient
	private List<Tag> tagList;
	
	

    public List<Tag> getTagList() {
		return tagList;
	}

	public void setTagList(List<Tag> tagList) {
		this.tagList = tagList;
	}

	public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public boolean isDelete() {
        return isDelete;
    }

    public void setDelete(boolean delete) {
        isDelete = delete;
    }

    public int getNewsStatus() {
        return newsStatus;
    }

    public void setNewsStatus(int newsStatus) {
        this.newsStatus = newsStatus;
    }

    public boolean getNewsLook() {
        return newsLook;
    }

    public void setNewsLook(boolean newsLook) {
        this.newsLook = newsLook;
    }

    public boolean isNewsTop() {
        return newsTop;
    }

    public void setNewsTop(boolean newsTop) {
        this.newsTop = newsTop;
    }

    public String getNewsAuthor() {
        return newsAuthor;
    }

    public void setNewsAuthor(String newsAuthor) {
        this.newsAuthor = newsAuthor;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Date getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(Date releaseDate) {
        this.releaseDate = releaseDate;
    }

    public int getClickHit() {
        return clickHit;
    }

    public void setClickHit(int clickHit) {
        this.clickHit = clickHit;
    }

    public int getReplyHit() {
        return replyHit;
    }

    public void setReplyHit(int replyHit) {
        this.replyHit = replyHit;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContentNoTag() {
        return contentNoTag;
    }

    public void setContentNoTag(String contentNoTag) {
        this.contentNoTag = contentNoTag;
    }

    public int getTypeId() {
        return typeId;
    }

    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }

    public String getKeyWord() {
        return keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public boolean isNewsLook() {
        return newsLook;
    }


    @Override
    public String toString() {
        return "Blog{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", summary='" + summary + '\'' +
                ", releaseDate=" + releaseDate +
                ", clickHit=" + clickHit +
                ", replyHit=" + replyHit +
                ", content='" + content + '\'' +
                ", contentNoTag='" + contentNoTag + '\'' +
                ", typeId=" + typeId +
                ", keyWord='" + keyWord + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isDelete=" + isDelete +
                ", newsStatus=" + newsStatus +
                ", newsLook=" + newsLook +
                ", newsTop=" + newsTop +
                ", newsAuthor='" + newsAuthor + '\'' +
                '}';
    }
}
